<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class BlastUserModel extends Model{
	protected $table='bzg_user';
	protected $primaryKey='id';
	public $timestamps = false;
	// protected $fillable = ['username','age','email','add_date'];

	public static function checkUsername($username,$password){
		$userInfo = BlastUserModel::where('username',$username)->where('check','normal')->first();
		if(!empty($userInfo)){
			$token = $userInfo->token;
			$passwd = md5($token.md5($password));

			if($passwd == $userInfo->password){
				return array('status'=>TRUE,'name'=>$userInfo->name);
			}else{
				return array('status'=>FALSE);
			}

		}else{
			return array('status'=>FALSE);
		}
	}
}